<?php
namespace Activity\Controller;
use Common\Controller\CommonController;

/**
 * 分享模块
 */
class ShareController extends CommonController {
	protected $_activity;
	protected $_activity_member;
	
	protected function _initialize(){
		parent::_initialize();
		$this->_activity = new \Activity\Model\ActivityModel();
		$this->_activity_member = new \Activity\Model\ActivityMemberModel();
	}
    
    
	/**
	 * 活动详情
	 */
	public function getActivityDetailAction(){
		$activityid = (int)I('request.activityid');
		$this->_getActivityDetail($activityid);
	}
	
	private function _getActivityDetail($activityid){
		if(empty($activityid)){
    		$this->status = 1000;
    		$this->msg = L('STATUS_1000');
    		$this->outPut();
		}
	
		$activity = $this->_activity->getActivityById($activityid);
		if(empty($activity)){
			$this->status = 2707;
			$this->msg = L('STATUS_2707');
			$this->outPut();
		}
		
		
		$custInfo = $this->_getCustInfo($activity['custid']);
		$activity['nickname'] = $custInfo['nickname'];
		$activity['area'] = $custInfo['area'];
		if(!empty($activity['cover'])) $activity['cover'] = json_decode($activity['cover'] , true);	
		$memberCount = $this->_activity_member->countMember($activityid);
		$activity['memberCount'] = (string)$memberCount;
		
		$this->data = $activity;
		$this->outPut();
	}
	
	
}
